#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef double db;

#define in read()
#define pii pair<int,int>
#define fi first
#define se second
#define FILE(x) freopen(x".in","r",stdin);\
	freopen(x".out","w",stdout);
#define pb push_back

int read(){
	int x = 0,sgn = 1;char ch = getchar();
	for(;!isdigit(ch);ch = getchar()) if(ch == '-') sgn = -1;
	for(;isdigit(ch);ch = getchar()) x = (x<<1)+(x<<3)+(ch^48);
	return x*sgn;
}

const int N = 2e6+10;

int nodenum,last,sz[N],h[N],cnt,n;
struct edge{int v,nxt;}e[N<<1];
void link(int x,int y){e[++cnt] = (edge){y,h[x]};h[x] = cnt;}
char S[N];
ll ans;

struct suf{
	int link,len;
	unordered_map<char,int> ch;
}s[N];
	
void add(char c){
	int cur = ++nodenum,p = last; last = cur; sz[cur] = 1;
	s[cur].len = s[p].len+1;
	while(~p && !s[p].ch[c]){s[p].ch[c] = cur; p = s[p].link;}
	if(p == -1) return s[cur].link = 0,void();
	int q = s[p].ch[c];
	if(s[q].len == s[p].len+1) return s[cur].link = q,void();
	int t = ++nodenum; s[t].link = s[q].link; s[t].len = s[p].len+1; s[t].ch = s[q].ch;
	while(~p && s[p].ch[c] == q) s[p].ch[c] = t,p = s[p].link;
	s[q].link = s[cur].link = t;
}

void dfs(int x){
	for(int i = h[x],y;i;i = e[i].nxt) dfs(y = e[i].v),sz[x] += sz[y];
	if(sz[x] != 1) ans = max(ans,1ll * sz[x] * s[x].len);
}

int main (){
#ifndef ONLINE_JUDGE
	freopen("1.in","r",stdin);
#endif
	scanf("%s",S+1); n = strlen(S+1); s[0].link = -1;
	for(int i = 1;i <= n;i++) add(S[i]);
	for(int i = 1;i <= nodenum;i++) link(s[i].link,i);
	dfs(0); printf("%lld\n",ans);
	return 0;
}

